package ai.people.platform.archives.service.impl;

import ai.people.netmon.framework.domain.archives.entity.ArchivesBaseInfo;
import ai.people.netmon.framework.domain.archives.entity.GangGroupArchivesBO;
import ai.people.netmon.framework.domain.archives.entity.GangGroupOrgPersonBO;
import ai.people.netmon.framework.domain.archives.request.ArchivesRequest;
import ai.people.platform.archives.mapper.ArchivesBaseInfoMapper;
import ai.people.platform.archives.service.ArchivesBaseInfoService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zhenglin
 * @since 2022-03-30
 */
@Service
@RequiredArgsConstructor
public class ArchivesBaseInfoServiceImpl extends ServiceImpl<ArchivesBaseInfoMapper, ArchivesBaseInfo> implements ArchivesBaseInfoService {


    /**
     * 档案基本信息mapper
     */
    private final ArchivesBaseInfoMapper archivesBaseInfoMapper;

    @Override
    public Page<ArchivesBaseInfo> pageCustom(Page<ArchivesBaseInfo> page, ArchivesRequest request) {
        return archivesBaseInfoMapper.pageCustom(page,request);
    }

    /**
     * 我的档案
     *
     * @param request 请求
     * @param userId  用户id
     * @return {@link List}<{@link ArchivesBaseInfo}>
     */
    @Override
    public List<ArchivesBaseInfo> myArchivesPage(ArchivesRequest request, Long userId) {
        return archivesBaseInfoMapper.myArchivesPage(request,userId);
    }

    /**
     * 统计我档案
     *
     * @param request 请求
     * @param userId  用户id
     * @return long
     */
    @Override
    public long myArchivesCount(ArchivesRequest request, Long userId) {
        return archivesBaseInfoMapper.myArchivesCount(request,userId);
    }

    @Override
    public void updateCoordinateAxisById(ArchivesBaseInfo archivesBaseInfo) {
        archivesBaseInfoMapper.updateCoordinateAxisById(archivesBaseInfo);
    }

    /**
     * 档案列表(团伙库)
     *
     * @return {@link List}<{@link GangGroupArchivesBO}>
     */
    @Override
    public List<GangGroupArchivesBO> selectGangGroup() {
        return archivesBaseInfoMapper.selectGangGroup();
    }

    @Override
    public GangGroupArchivesBO getForGangGroup(Long id) {
        return archivesBaseInfoMapper.getForGangGroup(id);
    }

    @Override
    public List<GangGroupOrgPersonBO> listForGangGroup(Set<String> archivesIds) {
        return archivesBaseInfoMapper.listForGangGroup(archivesIds);
    }

    @Override
    public boolean updateUpdateTime(Set<Long> upArchivesIds) {
        return archivesBaseInfoMapper.updateUpdateTime(upArchivesIds);
    }
}
